package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * AC
 */
class Solution101 {
    public boolean isSymmetric(TreeNode root) {
//        return TreeUtils.isSymmetricByBFS(root);
        return TreeUtils.isSymmetric(root);
    }
}

/**
 * 101. 对称二叉树
 */
public class leetcode101 {
    public static void main(String[] args) {
        Solution101 solution101 = new Solution101();
        Integer[] nums1 = {1, 2, 2, 3, 4, 4, 3};
        Integer[] nums2 = {1, 2, 2, null, 3, null, 3};
        Integer[] nums3 = {1, 2, 3};
        TreeNode root1 = TreeUtils.generateLeetcodeTree(nums1);
        TreeNode root2 = TreeUtils.generateLeetcodeTree(nums2);
        TreeNode root3 = TreeUtils.generateLeetcodeTree(nums3);
        System.out.println(solution101.isSymmetric(root1));
        System.out.println(solution101.isSymmetric(root2));
        System.out.println(solution101.isSymmetric(root3));
    }
}
